import request from '@/utils/request'

// 查询物资分配列表
export function listAllocation(query) {
  return request({
    url: '/aid/allocation/list',
    method: 'get',
    params: query
  })
}

// 查询物资分配详细
export function getAllocation(allocationId) {
  return request({
    url: '/aid/allocation/' + allocationId,
    method: 'get'
  })
}

// 新增物资分配
export function addAllocation(data) {
  return request({
    url: '/aid/allocation',
    method: 'post',
    data: data
  })
}

// 修改物资分配
export function updateAllocation(data) {
  return request({
    url: '/aid/allocation',
    method: 'put',
    data: data
  })
}

// 删除物资分配
export function delAllocation(allocationId) {
  return request({
    url: '/aid/allocation/' + allocationId,
    method: 'delete'
  })
}

// 审核物资分配
export function verifyAidAllocation(data) {
  return request({
    url: '/aid/allocation/verify',
    method: 'put',
    data: data
  })
}

// 根据捐赠ID查询分配记录
export function listByDonation(donationId) {
  return request({
    url: '/aid/allocation/donation/' + donationId,
    method: 'get'
  })
}

// 根据需求ID查询分配记录
export function listByDemand(demandId) {
  return request({
    url: '/aid/allocation/demand/' + demandId,
    method: 'get'
  })
}

// 导出物资分配
export function exportAllocation(query) {
  return request({
    url: '/aid/allocation/export',
    method: 'get',
    params: query
  })
}

// 获取可用的捐赠列表
export function getAvailableDonations() {
  return request({
    url: '/aid/donation/available',
    method: 'get'
  })
}

// 获取未满足的需求列表
export function getUnfulfilledDemands() {
  return request({
    url: '/aid/demand/unfulfilled',
    method: 'get'
  })
} 